<%#
 Copyright 2020-2022 sirpdboy Wich <sirpdboy@qq.com>
 https://github.com/sirpdboy/netspeedtest
 Licensed to the public under the Apache License 2.0.
-%>
<%

	local running = luci.sys.exec("busybox ps -w | grep homebox | grep -v grep  >/dev/null && echo -ne '1' ")
%>
<%+cbi/valueheader%>

<div class="cbi-map">
<% if running == "1" then %>
        <iframe id="homebox" style="width: 100%; min-height: 400px; height: 650px;border: none; border-radius: 3px;"></iframe>

<script type="text/javascript">
        document.getElementById("homebox").src = window.location.protocol + "//" + window.location.hostname + ":3300";
        document.getElementById("homebox").height = document.documentElement.clientHeight;
        window.onresize = function(){
            document.getElementById("homebox").height = document.documentElement.clientHeight;
        }
</script>
<% else %>
	<style>.running{text-align: center;} .running>h1{font-size: 25px; color: #333; margin: 1rem;} .running>p{ font-size: 1.2rem; color: #8391a2; margin: 1rem;}</style>
	<div class="running">
	<img src=""  height="100">
		<h1><font color="color:red"><%:The homebox service is not running.%></font></h1>
		<p><%:Please enable the Homebox service%></p>
    </div>
<% end %>
</div>
<%+cbi/valuefooter%>
